package com.gexin.model.order;

import com.gexin.common.cache.CacheUtils;
import com.gexin.model.order.base.BaseOrderState;

import java.util.List;

/**
 * 业务名称:  t_order_state(订单状态名称)
 */
@SuppressWarnings("serial")
public class OrderState extends BaseOrderState<OrderState> {
	public static final OrderState dao = new OrderState();
	/**等待支付**/
	public static final Integer State_Wait_Pay=0;
	/**支付成功 等待发货**/
	public static final Integer State_Pay_OK=1;
	/**发货成功**/
	public static final Integer State_Express_OK=2;
	/**订单完成**/
	public static final Integer State_Complete=3;
	/**退款了**/
	public static final Integer State_Refund=4;
	/**订单关闭了**/
	public static final Integer State_Closed=5;
	/**申请退款中....**/
	public static final Integer State_Apply_Refund=6;
	/** 用户申请维权 **/
	public static final Integer State_Rights=7;
	/** 拼团中  **/
	public static final Integer State_Group_Ing=8;
	/** 拼团失败 退款成功  **/
	public static final Integer State_Group_Fail_Refund_Ok=9;
	/** 拼团失败 等待退款  **/
	public static final Integer State_Group_Fail_Refund_Fail=10;
	/** 拼团成功 等待开奖 **/
	public static final Integer State_Wait_KaiJiang=11;
	/** 开奖退款成功   **/
	public static final Integer State_KaiJiang_Fial=12;

	private final String cache_key ="cache_key_order_state";
	/**
	 * fang 2016-06-22
	 * 后台 订单列表     找到所有的类型
	 *
	 */
	public List<OrderState> getAllState(){
		String sql=" select * from t_order_state order by state_id ";
		return dao.find(sql);
	}

	public   List<OrderState>  cache_GetStateList(){   //2016-05-27  增加type=0
		List<OrderState>   list = CacheUtils.getEhcache(cache_key);
		if(list==null){
			String sql="select * from t_order_state order by state_id";
			list =dao.find(sql);
			CacheUtils.setEhcache(cache_key, list);
		}
		return list;
	}

	public void cache_clear(){
		CacheUtils.delEhcache(cache_key);
	}


}
